<template>
  <div class="index-container">
    <div class="tab-list">
      <li :class="{ active: current === 'index' }" @click="goToPage('index')"><a>首页</a></li>
      <li :class="{ active: current === 'watch' }" @click="goToPage('watch')"><a>在线观影</a></li>
      <li :class="{ active: current === 'contract' }" @click="goToPage('contract')"><a>联系我们</a></li>
    </div>
    <div class="logo">猩猩影视</div>
    <img class="logo-img" :src="logo" alt="">
    <video autoplay loop muted id="bg-video" :width="width" :height="height" oncontextmenu="return false;">
      <source :src="'https://res.vcinema.com.cn/guanwangshipin2.mp4?v=' + version" type="video/mp4" />
      Your browser does not support the video tag.
    </video>
  </div>
</template>
<script>
const logo = require('../../../../public/images/xx_logo.png')
export default {
  computed: {
    version () {
      return this.$store.state.version
    }
  },
  methods: {
    setVideoSize () {
      const width = document.documentElement.clientWidth
      const height = document.documentElement.clientHeight
      this.width = width
      this.height = height
    },
    goToPage (target) {
      if (this.current !== target) {
        this.current = target
        let url = ''
        switch (target) {
          case 'watch':
            url = this.$router.resolve({
              path: '/movie/list'
            })
            window.open(url.href, '_blank')
            break
          default:
        }
      }
    }
  },
  data: () => {
    return {
      width: 0,
      height: 0,
      logo,
      current: 'index'
    }
  },
  created () {
    this.setVideoSize()
  }
}
</script>
<style scoped>
@import url(../../../global.css);
.index-container {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #222;
}
.logo {
  position: fixed;
  height: 55px;
  line-height: 55px;
  color: #fff;
  font-size: 26px;
  font-weight: bold;
  top: 30px;
  left: 90px;
  z-index: 10;
}
.logo-img {
  position: fixed;
  width: 50px;
  height: 50px;
  z-index: 10;
  top: 32px;
  left: 30px;
}
.tab-list {
  position: fixed;
  right: 30px;
  top: 30px;
  z-index: 10;
  cursor: pointer;
}
.tab-list li {
  display: inline-block;
  line-height: 55px;
  height: 55px;
  vertical-align: middle;
  margin-right: 25px;
  color: #d8d8d8;
  text-shadow: 0 1px 2px rgb(0 0 0 / 40%);
}
.tab-list li.active {
  color: #fff;
}
.tab-list li:hover {
  color: #fff;
}
.tab-list li.active a {
  border-bottom: 2px solid #e5eeed;
  padding: 0 3px 3px;
}
video {
  object-fit: cover;
}
</style>
